﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SinBiota.Model.Business.PersistenceServices.Implementation;

namespace Sinbiota.Web.Controllers
{
    public class LegacyTaxonomicGroupController : Controller
    {
        private readonly OccurrencePersistenceServices _occurrencePersistenceServices;

        public LegacyTaxonomicGroupController(OccurrencePersistenceServices occurrencePersistenceServices)
        {
            _occurrencePersistenceServices = occurrencePersistenceServices;
        }

        // GET: /LegacyTaxonomicGroup/

        public ActionResult Index()
        {
            return RedirectToAction("Index", "Home");
        }

        // AJAX: 
        //Get all Groups:
        public JsonResult GetAll()
        {
            var list = _occurrencePersistenceServices.FindAllLegacyTaxonomicGroups().OrderBy(x => x.Name);
            return Json(list);
        }
    }
}
